home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Printer / aa_Intel_Only / lprManager.0.01 / lprManager / InfoView.m < prev    next >
Text File  |  1995-09-17  |  1KB  |  86 lines

  1.  
  2. #import "InfoView.h"
  3.  
  4. void handler(DPSTimedEntry teNumber, double now, void* userData)
  5. {
  6.     id obj = (id)userData;
  7.     [obj animateDissolve];
  8. }
  9.  
  10. @implementation InfoView
  11. - initFrame:(const NXRect *)frameRect
  12. {
  13.     frontImageName = [NSString stringWithCString:"author"];
  14.     backImageName = [NSString stringWithCString:"app"];
  15.     return [super initFrame:frameRect];
  16. }
  17.  
  18. - animate:sender
  19. {
  20.     [self removeTE];
  21.     [self display];
  22.     [window setDelegate:self];
  23.     gray = 0.0;
  24.     animateTE = DPSAddTimedEntry(.002, (DPSTimedEntryProc)handler, self, 
  25.             NX_BASETHRESHOLD);
  26.     return self;
  27. }
  28.  
  29. - removeTE
  30. {
  31.     if(animateTE)
  32.         {
  33.             NSString* tmpString = frontImageName;
  34.     
  35.       DPSRemoveTimedEntry(animateTE);
  36.          animateTE = 0;
  37.          frontImageName = backImageName;
  38.          backImageName = tmpString;
  39.         }
  40.     return self;
  41. }
  42.  
  43. - windowWillClose:sender
  44. {
  45.     [self removeTE];
  46.     return self;
  47. }
  48.  
  49. - animateDissolve
  50. {
  51.     id image;
  52.  
  53.     [self lockFocus];
  54.     image = [NXImage findImageNamed: [frontImageName cString]];
  55.     [image dissolve:gray toPoint:&bounds];
  56.     [self unlockFocus];
  57.     [window flushWindow];
  58.     NXPing();
  59.     gray += 0.005;
  60.     if( gray>1.0 )
  61.         {
  62.          [self removeTE];
  63.         }
  64.     return self;
  65. }
  66.  
  67. - mouseDown:(NXEvent*)theEvent
  68. {
  69.     [self animate:self];
  70.     return [super mouseDown:theEvent];
  71. }
  72.  
  73. - drawSelf:(const NXRect*)rects :(int)rectCount
  74. {
  75.     id image;
  76.  
  77.     PSsetgray(NX_LTGRAY);
  78.     NXRectFill(&bounds);
  79.     [self lockFocus];
  80.     image = [NXImage findImageNamed:[backImageName cString]];
  81.     [image composite:NX_SOVER toPoint:&bounds];
  82.     [self unlockFocus];
  83.     return self;
  84. }
  85. @end
  86.